Skip to content

Conversation

@djhvscf
Copy link
Collaborator

@djhvscf djhvscf commented Jan 3, 2026

🤔Type of Request

  • Bug fix
  • New feature
  • Improvement
  • Documentation
  • Other

🔗Resolves an issue?
Fix #8123

📝Changelog

  • Core
  • Extensions

☑️Self Check before Merge

⚠️ Please check all items below before reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

@@ -11,7 +11,7 @@ Object.assign($.fn.bootstrapTable.defaults, {
showAutoRefresh: true,
autoRefreshInterval: 60,
autoRefreshSilent: true,
autoRefreshStatus: true,
autoRefreshStatus: false,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the default value here be modified?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #8123 by correcting the auto-refresh extension's toggle behavior and default state. The auto-refresh button now starts in an inactive state by default and properly toggles its visual state when clicked.

Changes:

  • Changed default autoRefreshStatus from true to false to prevent auto-refresh from starting automatically
  • Fixed button selector from class-based to attribute-based to match the framework's button naming convention
  • Refactored attribute handling to conditionally apply the active class based on refresh status

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/extensions/auto-refresh/bootstrap-table-auto-refresh.js Updated default state, fixed button selectors, and improved attribute handling for the auto-refresh toggle button
cypress/e2e/extensions/auto-refresh/test.html Added test HTML page for auto-refresh functionality testing
cypress/e2e/extensions/auto-refresh/auto-refresh.cy.js Added Cypress test to verify toggle behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

attributes.class = this.constants.classes.buttonActive || 'active'
}

this.buttons = Object.assign(this.buttons || {}, {
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defensive || {} fallback is unnecessary here. The base class always initializes this.buttons in the initConstants() method (see src/modules/initialization.js line 32-34). This is inconsistent with other extensions like copy-rows, custom-view, export, filter-control, and toolbar which use Object.assign(this.buttons, {...}) without the fallback. While this doesn't cause issues, it's better to maintain consistency across the codebase.

Suggested change
this.buttons = Object.assign(this.buttons || {}, {
Object.assign(this.buttons, {

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +4
cy.visit('cypress/e2e/extensions/auto-refresh/test.html')
cy.get('[name="autoRefresh"]').click()
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test should verify the initial state of the auto-refresh button. Since the default value of autoRefreshStatus was changed to false, the button should not have the 'active' class when the page first loads. Consider adding an assertion before the first click to verify this initial state.

Copilot uses AI. Check for mistakes.
'aria-label': this.options.formatAutoRefresh(),
title: this.options.formatAutoRefresh()
}
event: this.toggleAutoRefresh.bind(this),
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .bind(this) call is redundant here. The toolbar module already calls event handlers with the correct context using .call(this) (see src/modules/toolbar.js line 230). While this doesn't cause any issues, it's unnecessary and inconsistent with other extensions like copy-rows, custom-view, and filter-control which don't use .bind().

Suggested change
event: this.toggleAutoRefresh.bind(this),
event: this.toggleAutoRefresh,

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autoRefresh button active state does not work

3 participants